package chapter_17_command.classic;

/**
 * @author yaochenglong
 * @date 2017/10/20
 */
public class Client {
    public static void main(String[] args) {
        //定义接受者
        Receiver receiver = new ConcreteReceiver1();
        //定义命令，命令由哪个接收者执行
        Command command = new ConcreteCommand1(receiver);

        //定义调用者
        Invoker invoker = new Invoker();
        //调用者接收命令
        invoker.setCommand(command);
        //调用者执行命令
        invoker.action();

        //定义命令2，还是让ConcreteReceiver1接收
        Command command2 = new ConcreteCommand1(receiver);

        invoker.setCommand(command2);
        invoker.action();
    }
}
